package com.xl.sst.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.xl.sst.vo.Touzi;
import com.xl.sst.biz.IndexBiz;
import com.xl.sst.vo.BigClass;
import com.xl.sst.vo.Eightclass;
import com.xl.sst.vo.Image;

@Controller
@RequestMapping("/u")
public class IndexController {
	@Resource
	private IndexBiz IndexBiz;
	
	@RequestMapping("/login.do")
	@ResponseBody
	public Integer login(String name,String password){
		
		System.out.println(name);
		System.out.println(password);
		return 0;	
	}
	
	//跳转到首页
	@RequestMapping("/index.do")
	public String index(){
		return "redirect:/view/index.html";	
	}
	
	//主页轮播图
	@RequestMapping("/lunbotu.do")
	@ResponseBody
	public Map<String,Object> lunbo(){
		Map<String,Object>map=new HashMap<String,Object>();
		List<Image>list=IndexBiz.selectAllImageByStatus(1);//传入1代表轮播图
		map.put("banner", list);
		return map;
		
	}
	//主页公司货商城
	@RequestMapping("/gongsihuo.do")
	@ResponseBody
	public Map<String,Object> gongsihuo(){
		Map<String,Object>map=new HashMap<String,Object>();
		List<BigClass> m = IndexBiz.selectXuQiuAll();
		map.put("gongsihuo", m);
		return map;	
	}
	//主页热门需求
	@RequestMapping("/xuqiu.do")
	@ResponseBody
	public Map<String,Object> xuqiu(){
		Map<String,Object>map=new HashMap<String,Object>();
		List<BigClass> m = IndexBiz.selectXuQiuAll();
		map.put("xuqiu", m);
		return map;	
	}
	
	
	//主页投资
	@RequestMapping("/touzi.do")
	@ResponseBody
	public Map<String,Object> touzi(){
		Map<String,Object>map=new HashMap<String,Object>();
		List<Touzi> list = IndexBiz.selectTouziAll();
		map.put("touzi",list);
		return map;	
	}
	//主页四个小广告
	@RequestMapping("/guanggao.do")
	@ResponseBody
	public Map<String,Object> guanggao(){
		Map<String,Object>map=new HashMap<String,Object>();
		List<Image>list=IndexBiz.selectAllImageByStatus(2);//传入2代表四个小广告
		map.put("ad4", list);
		return map;
	}
	
		//主页八大分类
		@RequestMapping("/fenlei.do")
		@ResponseBody
		public Map<String,Object> fenlei(){
			Map<String,Object>map=new HashMap<String, Object>();
			List<Eightclass> list = IndexBiz.selectAllEightclass();
			map.put("eightclass", list);
			return map;
		}
	
	
	
	
	
	
	

}
